package com.cloudkinto.controller.cost;


import com.cloudkinto.base.BaseController;
import com.cloudkinto.common.annotations.UserSessionRequired;
import com.cloudkinto.common.utils.dict.StaticDict;
import com.cloudkinto.common.web.PageResult;
import com.cloudkinto.common.web.SingleResult;
import com.cloudkinto.service.cost.CostService;
import com.cloudkinto.service.cost.vo.CostItemGetReq;
import com.cloudkinto.service.cost.vo.CostWorkAddReq;
import com.cloudkinto.service.detective.vo.pick.BatchReq;
import com.cloudkinto.service.warehouse.WarehouseService;
import com.cloudkinto.vo.cost.*;
import com.cloudkinto.vo.warehouse.CompanyWarehouseVo;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 * @author hua
 * @since 2024-11-29
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "业务费用wms模块")
@RequestMapping("/api/admin/wms/Cost")
public class CostWmsController extends BaseController {
    private final Logger logger = LoggerFactory.getLogger(CostWmsController.class);

    private final CostService service;
    private final WarehouseService warehouseService;


    @UserSessionRequired
    @PostMapping("/getCostItem")
    @ApiOperation(value = "获取费用详情", notes = "获取费用详情")
    public SingleResult getCostItem(@RequestBody @Validated CostItemGetReq req) {
        return SingleResult.success(service.getCostItem(req.getIds(), req.getOrderType(), getTenantId(StaticDict.System_Source.WMS.getValue())));
    }


    @UserSessionRequired
    @PostMapping("/manualAdjust")
    @ApiOperation(value = "手动调整", notes = "手动调整")
    public SingleResult manualAdjust(@RequestBody @Validated CostManualAdjustWmsReq req) {
        Long userId = getCurrentUserId();
        service.manualAdjust(req, userId);
        return SingleResult.success();
    }


}

